"use strict"; (function(){ var $body=jQuery('body'); var $window=jQuery(window); function menuHideExtraElements(){ jQuery('.sf-more-li, .sf-logo-li').remove(); var windowWidth=jQuery('body').innerWidth(); jQuery('.sf-menu').each(function(){ var $thisMenu=jQuery(this); var $menuWraper=$thisMenu.closest('.mainmenu_wrapper'); $menuWraper.attr('style', ''); if(windowWidth > 991){ var $menuLis=$menuWraper.find('.sf-menu > li'); $menuLis.removeClass('sf-md-hidden'); var $headerLogoCenter=$thisMenu.closest('.header_logo_center'); var logoWidth=0; var summaryLiWidth=0; if($headerLogoCenter.length){ var $logo=$headerLogoCenter.find('.logo'); logoWidth=$logo.outerWidth(true) + 70; } var wrapperWidth=$menuWraper.outerWidth(true); $menuLis.each(function(index){ var elementWidth=jQuery(this).outerWidth(); summaryLiWidth +=elementWidth; if(summaryLiWidth >=(wrapperWidth-logoWidth)){ var $newLi=jQuery('
  • ...
  • '); jQuery($menuLis[index - 1 ]).before($newLi); var newLiWidth=jQuery($newLi).outerWidth(true); var $extraLiElements=$menuLis.filter(':gt('+(index - 2) +')'); $extraLiElements.clone().appendTo($newLi.find('ul')); $extraLiElements.addClass('sf-md-hidden'); return false; }}); if($headerLogoCenter.length){ var $menuLisVisible=$headerLogoCenter.find('.sf-menu > li:not(.sf-md-hidden)'); var menuLength=$menuLisVisible.length; var summaryLiVisibleWidth=0; $menuLisVisible.each(function(){ summaryLiVisibleWidth +=jQuery(this).outerWidth(); }); var centerLi=Math.floor(menuLength / 2); if((menuLength % 2===0)){ centerLi--; } var $liLeftFromLogo=$menuLisVisible.eq(centerLi); $liLeftFromLogo.after('
  • '); $headerLogoCenter.find('.sf-logo-li').width(logoWidth); var liLeftRightDotX=$liLeftFromLogo.offset().left + $liLeftFromLogo.outerWidth(); var logoLeftDotX=windowWidth/2 - logoWidth/2; var menuLeftOffset=liLeftRightDotX - logoLeftDotX; $menuWraper.css({'left': -menuLeftOffset}) }} }); } function initMegaMenu(){ var $megaMenu=jQuery('.mainmenu_wrapper .mega-menu'); if($megaMenu.length){ var windowWidth=jQuery('body').innerWidth(); if(windowWidth > 991){ $megaMenu.each(function(){ var $thisMegaMenu=jQuery(this); $thisMegaMenu.css({'display': 'block', 'left': 'auto'}); var thisWidth=$thisMegaMenu.outerWidth(); var thisOffset=$thisMegaMenu.offset().left; var thisLeft=(thisOffset + (thisWidth/2)) - windowWidth/2; $thisMegaMenu.css({'left':-thisLeft, 'display': 'none'}); if(!$thisMegaMenu.closest('ul').hasClass('nav')){ $thisMegaMenu.css('left', ''); }}); }} } function affixSidebarInit(){ var $affixAside=jQuery('.affix-aside'); if($affixAside.length){ $affixAside.on('affix.bs.affix', function(e){ var affixWidth=$affixAside.width() - 1; var affixLeft=$affixAside.offset().left; $affixAside .width(affixWidth) .css("left", affixLeft); }).on('affix-top.bs.affix affix-bottom.bs.affix', function(e){ $affixAside.css({"width": "", "left": ""}); }); var offsetTop=$affixAside.offset().top - jQuery('.page_header').height(); var offsetBottom=jQuery('.page_footer').outerHeight(true) + jQuery('.page_copyright').outerHeight(true); $affixAside.affix({ offset: { top: offsetTop, bottom: offsetBottom }, }); jQuery(window).on('resize', function(){ $affixAside.css({"width": "", "left": ""}); if($affixAside.hasClass('affix')){ $affixAside.removeClass("affix").css("left", "").addClass("affix-top"); } var offsetTop=jQuery('.page_topline').outerHeight(true) + jQuery('.page_toplogo').outerHeight(true) + jQuery('.page_header').outerHeight(true) + jQuery('.page_breadcrumbs').outerHeight(true) + jQuery('.blog_slider').outerHeight(true); var offsetBottom=jQuery('.page_footer').outerHeight(true) + jQuery('.page_copyright').outerHeight(true); $affixAside.data('bs.affix').options.offset.top=offsetTop; $affixAside.data('bs.affix').options.offset.bottom=offsetBottom; $affixAside.affix('checkPosition'); }); }} function initAnimateElement(self, index){ var animationClass = !self.data('animation') ? 'fadeInUp':self.data('animation'); var animationDelay = !self.data('delay') ? 150:self.data('delay'); setTimeout(function(){ self.addClass("animated " + animationClass); }, index * animationDelay); } function initCounter(self){ if(self.hasClass('counted')){ return; }else{ self.countTo().addClass('counted'); }} function initProgressbar(el){ el.progressbar({ transition_delay: 300 }); } function initChart(el){ var data=el.data(); var size=data.size ? data.size:270; var line=data.line ? data.line:20; var bgcolor=data.bgcolor ? data.bgcolor:'#ffffff'; var trackcolor=data.trackcolor ? data.trackcolor:'#c14240'; var speed=data.speed ? data.speed:3000; el.easyPieChart({ barColor: trackcolor, trackColor: bgcolor, scaleColor: false, scaleLength: false, lineCap: 'butt', lineWidth: line, size: size, rotate: 0, animate: speed, onStep: function(from, to, percent){ jQuery(this.el).find('.percent').text(Math.round(percent)); }}); } function headerColumnsEqualize(){ var $header=jQuery('.page_header').first(); var $leftLogo=$header.find('.header_left_logo'); var $rightButtons=$header.find('.header_right_buttons'); if(parseInt($leftLogo.css('width')) > parseInt($rightButtons.css('width'))){ $rightButtons.css('min-width', $leftLogo.css('width')); }else{ $leftLogo.css('min-width', $rightButtons.css('width')); }} function relatedPostsThumbnail(){ jQuery('.related-posts .item-media-wrap').each(function(i, el){ var $mediaWrap=jQuery(el); var $media=$mediaWrap.children('.item-media'); var $mediaImage=$media.children('img'); var requiredImageWidth=$mediaWrap.height() * $mediaImage.width() / $mediaImage.height(); if(requiredImageWidth > $media.width()){ $mediaImage.css('width', requiredImageWidth); }else{ $mediaImage.css('max-width', '100%'); }}) } function windowLoadInit(){ if(jQuery().scrollbar){ jQuery('[class*="scrollbar-"]').scrollbar(); } if(jQuery().superfish){ jQuery('ul.sf-menu').superfish({ popUpSelector: 'ul:not(.mega-menu ul), .mega-menu ', delay: 700, animation: {opacity:'show', marginTop: 0}, animationOut: {opacity: 'hide', marginTop: 5}, speed: 200, speedOut: 200, disableHI: false, cssArrows: true, autoArrows: true, onInit: function (){ var $thisMenu=jQuery(this); $thisMenu.find('.sf-with-ul').after(''); $thisMenu.find('.sf-menu-item-mobile-toggler').on('click', function (e){ var $parentLi=jQuery(this).parent(); if($parentLi.hasClass('sfHover')){ $parentLi.superfish('hide'); }}); }}); jQuery('ul.sf-menu-side').superfish({ popUpSelector: 'ul:not(.mega-menu ul), .mega-menu ', delay: 500, animation: {opacity:'show', height: 100 +'%'}, animationOut: {opacity: 'hide', height: 0}, speed: 400, speedOut: 300, disableHI: false, cssArrows: true, autoArrows: true }); } jQuery('.toggle_menu').on('click', function(){ jQuery(this) .toggleClass('mobile-active') .closest('.page_header') .toggleClass('mobile-active') .end() .closest('.page_toplogo') .next() .find('.page_header') .toggleClass('mobile-active'); }); jQuery('.mainmenu a').on('click', function(){ var $this=jQuery(this); if(($this.hasClass('sf-with-ul'))||!($this.attr('href').charAt(0)==='#')){ return; } $this .closest('.page_header') .toggleClass('mobile-active') .find('.toggle_menu') .toggleClass('mobile-active'); }); var $sideHeader=jQuery('.page_header_side'); jQuery('ul.menu-side-click').find('li').each(function(){ var $thisLi=jQuery(this); if($thisLi.find('ul').length){ $thisLi .append('') .find('.activate_submenu, > a') .on('click', function(e){ var $thisSpanOrA=jQuery(this); if(($thisSpanOrA.attr('href')==='#')||!($thisSpanOrA.parent().hasClass('active-submenu'))){ e.preventDefault(); } if($thisSpanOrA.parent().hasClass('active-submenu')){ $thisSpanOrA.parent().removeClass('active-submenu'); return; } $thisLi.addClass('active-submenu').siblings().removeClass('active-submenu'); }); }}); if($sideHeader.length){ jQuery('.toggle_menu_side').on('click', function(){ var $thisToggler=jQuery(this); if($thisToggler.hasClass('header-slide')){ $sideHeader.toggleClass('active-slide-side-header'); }else{ if($thisToggler.parent().hasClass('header_side_right')){ $body.toggleClass('active-side-header slide-right'); }else{ $body.toggleClass('active-side-header'); }} }); $body.on('click', function(e){ if(!(jQuery(e.target).closest('.page_header_side').length)&&!($sideHeader.hasClass('page_header_side_sticked'))){ $sideHeader.removeClass('active-slide-side-header'); $body.removeClass('active-side-header slide-right'); }}); } var MainWindowWidth=jQuery(window).width(); var boxWrapperWidth=jQuery('#box_wrapper').width(); jQuery(window).on('resize', function(){ MainWindowWidth=jQuery(window).width(); boxWrapperWidth=jQuery('#box_wrapper').width(); }); jQuery('.mainmenu_wrapper .sf-menu').on('mouseover', 'ul li', function(){ if(MainWindowWidth > 991){ var $this=jQuery(this); var subMenuExist=$this.find('ul').length; if(subMenuExist > 0){ var subMenuWidth=$this.find('ul, div').first().width(); var subMenuOffset=$this.find('ul, div').first().parent().offset().left + subMenuWidth; if((subMenuOffset + subMenuWidth) > boxWrapperWidth){ var newSubMenuPosition=subMenuWidth + 0; $this.find('ul, div').first().css({ left: -newSubMenuPosition }); }else{ $this.find('ul, div').first().css({ left: '100%' }); }} }}).on('mouseover', '> li', function(){ if(MainWindowWidth > 991){ var $this=jQuery(this); var subMenuExist=$this.find('ul').length; if(subMenuExist > 0){ var subMenuWidth=$this.find('ul').width(); var subMenuOffset=$this.find('ul').parent().offset().left - (jQuery(window).width() / 2 - boxWrapperWidth / 2); if((subMenuOffset + subMenuWidth) > boxWrapperWidth){ var newSubMenuPosition=boxWrapperWidth - (subMenuOffset + subMenuWidth); $this.find('ul').first().css({ left: newSubMenuPosition }); }} }}); var navHeight=jQuery('.page_header').outerHeight(true); if(jQuery('.mainmenu_side_wrapper').length){ $body.scrollspy({ target: '.mainmenu_side_wrapper', offset: navHeight }); }else if(jQuery('.mainmenu_wrapper').length){ $body.scrollspy({ target: '.mainmenu_wrapper', offset: navHeight }) } if(jQuery().localScroll){ jQuery('.mainmenu_wrapper > ul, .mainmenu_side_wrapper > ul, #land, .scroll_button_wrap').localScroll({ duration:900, easing:'easeInOutQuart', offset: -navHeight+40 }); } jQuery(".bg_teaser, .image_cover").each(function(){ var $teaser=jQuery(this); var $image=$teaser.find("img").first(); if(!$image.length){ $image=$teaser.parent().find("img").first(); } if(!$image.length){ return; } var imagePath=$image.attr("src"); $teaser.css("background-image", "url(" + imagePath + ")"); var $imageParent=$image.parent(); if($imageParent.is('a')){ $teaser.prepend($image.parent().clone().html('')); $imageParent.attr('data-gal', ''); }}); if(jQuery().UItoTop){ jQuery().UItoTop({ easingType: 'easeInOutQuart' }); } if(jQuery().parallax){ jQuery('.parallax').parallax("50%", 0.01); } if(jQuery().prettyPhoto){ jQuery("a[data-gal^='prettyPhoto']").prettyPhoto({ hook: 'data-gal', theme: 'facebook', social_tools: false, default_width: 1170, default_height: 780 }); } if(jQuery().carousel){ jQuery('.carousel').carousel(); } jQuery('.nav-tabs').each(function(){ jQuery(this).find('a').first().tab('show'); }); jQuery('.tab-content').each(function(){ jQuery(this).find('.tab-pane').first().addClass('fade in'); }); jQuery('.panel-group').each(function(){ jQuery(this).find('a').first().filter('.collapsed').trigger('click'); }); if(jQuery().tooltip){ jQuery('[data-toggle="tooltip"]').tooltip(); } if(jQuery().countdown){ var demoDate=new Date(); demoDate.setMonth(demoDate.getMonth()+1); jQuery('#comingsoon-countdown').countdown({until: demoDate}); } jQuery(".search_modal_button").on('click', function(e){ e.preventDefault(); jQuery('#search_modal').modal('show').find('input').first().focus(); }); if(jQuery().flexslider){ var $introSlider=jQuery(".intro_section .flexslider"); $introSlider.each(function(index){ var $currentSlider=jQuery(this); var data=$currentSlider.data(); var nav=(data.nav!=='undefined') ? data.nav:true; var dots=(data.dots!=='undefined') ? data.dots:true; $currentSlider.flexslider({ animation: "fade", pauseOnHover: true, useCSS: true, controlNav: dots, directionNav: nav, prevText: "", nextText: "", smoothHeight: false, slideshowSpeed:10000, animationSpeed:600, start: function(slider){ slider.find('.slide_description').children().css({'visibility': 'hidden'}); slider.find('.flex-active-slide .slide_description').children().each(function(index){ var self=jQuery(this); var animationClass = !self.data('animation') ? 'fadeInRight':self.data('animation'); setTimeout(function(){ self.addClass("animated "+animationClass); }, index*200); }); slider.find('.flex-control-nav').find('a').each(function(){ jQuery(this).html('0' + jQuery(this).html()); }) }, after: function(slider){ slider.find('.flex-active-slide .slide_description').children().each(function(index){ var self=jQuery(this); var animationClass = !self.data('animation') ? 'fadeInRight':self.data('animation'); setTimeout(function(){ self.addClass("animated "+animationClass); }, index*200); }); }, end :function(slider){ slider.find('.slide_description').children().each(function(){ var self=jQuery(this); var animationClass = !self.data('animation') ? 'fadeInRight':self.data('animation'); self.removeClass('animated ' + animationClass).css({'visibility': 'hidden'}); }); }, }) .find('.flex-control-nav') .wrap('